<template>
  <div class="app-container" >
    <h3 align="center">项目申请书</h3>
    <el-row :gutter="18" type="flex" >
      <el-col :span="9" :offset="8">
      <div style = "padding-top: 10px;" >
        <el-form ref="form" :model="form" label-width="80px" >
          
            <el-form-item label="项目名称">
              <el-input v-model="form.name" style="width: 80%;"></el-input>
            </el-form-item>

            <el-form-item label="项目成本">
              <el-input v-model="form.cost" style="width: 80%;"></el-input>
            </el-form-item>

            <el-form-item label="项目资源">
              <el-input v-model="form.resourse" style="width: 80%;"></el-input>
            </el-form-item>
            <el-form-item label="项目简介">
              <el-input type="textarea" v-model="form.desc" :autosize="{ minRows: 8, maxRows: 14}" style="width: 80%;"></el-input>
            </el-form-item>
            <el-form-item label="项目备注">
              <el-input type="textarea" v-model="form.remark" style="width: 80%;"></el-input>
            </el-form-item>
            
        </el-form>
      </div>
      </el-col>
    </el-row>
    <el-row>
      <div align="center">
        <el-button type="primary" @click="onSubmit" >立即申请</el-button>

      </div>
    </el-row>
    

</div>
</template>
<script>
  import global from '../../Global'

  export default {
    data() {
      return {
        form: {
          userId:'',
          name: '',
          // region: '', //类型
          // startDate: '',
          // startTime: '',
          // endDtae: '',
          // endTime: '',
          cost: '',
          resourse: '',
          // delivery: false, //是否紧急
          desc: '', //简介
          remark: '',
          roles: [],//当前用户所有信息
        },
        listLoading: false,//数据加载等待动画
        dialogFormVisible: false,//增加按钮弹窗能不能看到
        adminName: '管理员' ,
        title: '项目立项'
      }
    },
    created() {
      this.form.userId = global.obj.userId;
    },
    methods: {
      onSubmit() {
        this.api({
          url: "/project/submitProject",
          method: "post",
          data: this.form
        }).then(() => {
          let msg = "提交成功,请耐心等待审核";
          this.$message({
            message: msg,
            type: 'success',
            duration: 1 * 1000
          })
        })
      },
      getAllRoles() {
        this.api({
          url: "/user/getAllRoles",
          method: "get"
        }).then(data => {
          this.roles = data.list;
        })
      },
      showCreate() {
        this.dialogFormVisible = true;//显示弹窗
      },      
      getIndex($index) {
        //表格序号
        return $index + 1
      },
      demo(){
        console.log(global.obj.userId)
      }
    }
  }
</script>


<style scoped>
  .requiredPerm {
    color: #ff0e13;
  }
</style>
